<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" xmlns:core="http://typo3.org/ns/TYPO3/CMS/Core/ViewHelpers" data-namespace-typo3-fluid="true">
    <f:if condition="{missingClasses}">
        <f:be.infobox title="{f:translate(key:'msg.invalidTaskClass.infobox.title', arguments: '{0: \'{missingClasses ->f:count()}\'}')}" state="2">
            <f:format.raw><f:translate key="msg.invalidTaskClass.infobox.message" /></f:format.raw>
        </f:be.infobox>
    </f:if>
    <f:for each="{tasks}" as="taskGroup" iteration="groupIterator">
        <f:if condition="{taskGroup.tasks -> f:count()}">
            <div class="tx_scheduler_mod1_table">
                <div class="panel panel-space panel-default recordlist">
                    <f:if condition="{taskGroup.groupName} == ''">
                        <f:then>
                            <f:if condition="{tasks -> f:count()}>1">
                                <div class="panel-heading" data-task-group-id="{groupIterator.index}">
                                    <a href="#" title="{f:translate(key: 'label.group')}" class="t3js-toggle-recordlist" data-table="task-group-{groupIterator.index}" data-toggle="collapse" data-target="#recordlist-task-group-{groupIterator.index}">
                                        {f:translate(id: 'label.noGroup')}</span> (<span class="t3js-table-total-items" title="{f:translate(id: 'label.noGroup.taskCount')}">{taskGroup.tasks -> f:count()}</span>)
                                    </a>
                                    <a href="#" class="pull-right t3js-toggle-recordlist" data-table="task-group-{groupIterator.index}" data-toggle="collapse" data-target="#recordlist-task-group-{groupIterator.index}">
                                        <span class="caret"></span>
                                    </a>
                                </div>
                            </f:if>
                        </f:then>
                        <f:else>
                            <div class="panel-heading" data-task-group-id="{groupIterator.index}">
                                <a href="#" title="{f:translate(key: 'label.group')}" class="t3js-toggle-recordlist" data-table="task-group-{groupIterator.index}" data-toggle="collapse" data-target="#recordlist-task-group-{groupIterator.index}">
                                    {taskGroup.groupName}</span> (<span class="t3js-table-total-items" title="{f:translate(id: 'label.group.taskCount')}">{taskGroup.tasks -> f:count()}</span>)
                                </a>
                                <a href="#" class="pull-right t3js-toggle-recordlist" data-table="task-group-{groupIterator.index}" data-toggle="collapse" data-target="#recordlist-task-group-{groupIterator.index}">
                                    <span class="caret"></span>
                                </a>
                            </div>
                        </f:else>
                    </f:if>
                    <div class="collapse in" data-state="expanded" id="recordlist-task-group-{groupIterator.index}">
                        <div class="table-fit">
                            <table class="table table-striped table-hover taskGroup-table">
                            <thead>
                                <tr class="taskGroup_{groupIterator.index}">
                                    <th><span class="t-span"><a class="btn btn-default checkall" href="#" id="checkall" title="{f:translate(key:'label.checkAll')}"><core:icon identifier="actions-document-select"/></a></span></th>
                                    <th><span class="t-span"><f:translate key="label.id"/></span></th>
                                    <th><span class="t-span"><f:translate key="task"/></span></th>
                                    <th></th>
                                    <th><span class="t-span"><f:translate key="label.type"/></span></th>
                                    <th><span class="t-span"><f:translate key="label.frequency"/></span></th>
                                    <th><span class="t-span"><f:translate key="label.parallel"/></span></th>
                                    <th><span class="t-span"><f:translate key="label.lastExecution"/></span></th>
                                    <th><span class="t-span"><f:translate key="label.nextExecution"/></span></th>
                                    <th><span class="t-span"></span></th>
                                </tr>
                            </thead>
                            <f:for each="{taskGroup.tasks}" as="taskRecord" iteration="taskIterator">
                                <f:if condition="{taskRecord.validClass}">
                                    <tr class="{taskRecord.showAsDisabled} taskGroup_{groupIterator.index}">
                                        <td><span class="t-span"><label class="btn btn-default btn-checkbox"><input type="checkbox" name="tx_scheduler[execute][]" value="{taskRecord.uid}" id="task_{taskRecord.uid}"><span class="t3-icon fa"></span></label></span></td>
                                        <td class="right"><span class="t-span">{taskRecord.uid}</span></td>
                                        <td class="nowrap-disabled">
                                            <span class="t-span">
                                                <div class="name">
                                                    <a href="{moduleUri}&CMD=edit&tx_scheduler[uid]={taskRecord.uid}">
                                                        <strong>{taskRecord.classTitle} ({taskRecord.classExtension})</strong>
                                                        <f:if condition="{taskRecord.progress}">
                                                            <div class="progress">
                                                                <div class="progress-bar progress-bar-striped" role="progressbar" aria-valuenow="{taskRecord.progress}" aria-valuemin="0" aria-valuemax="100" style="width: {taskRecord.progress}%;">{taskRecord.progress}%</div>
                                                            </div>
                                                        </f:if>
                                                        <f:if condition="{taskRecord.additionalInformation}">
                                                            <div class="additional-information"><f:format.nl2br>{taskRecord.additionalInformation}</f:format.nl2br></div>
                                                        </f:if>
                                                    </a>
                                                </div>
                                                <f:if condition="{taskRecord.description} != ''">
                                                    <div class="text-muted" style="margin-top: 0.5em;"><f:format.nl2br>{taskRecord.description}</f:format.nl2br></div>
                                                </f:if>
                                            </span>
                                        </td>
                                        <td>
                                            <f:for each="{taskRecord.labels}" as="label">
                                                <f:if condition="{taskRecord.validClass}">
                                                    <span class="label label-{label.class}" title="{label.desciption}">{label.text}</span>
                                                </f:if>
                                            </f:for>
                                        </td>
                                        <td><span class="t-span">{taskRecord.execType}</span></td>
                                        <td><span class="t-span">{taskRecord.frequency}</span></td>
                                        <td><span class="t-span">{taskRecord.multiple}</span></td>
                                        <td><span class="t-span">{taskRecord.lastExecution}</span></td>
                                        <td><span class="t-span {taskRecord.labels.nextexecution.class}">{taskRecord.nextDate}</span></td>
                                        <td class="nowrap">
                                            <span class="t-span">
                                                <f:if condition="{taskRecord.isRunning}">
                                                    <f:then>
                                                        <div class="btn-group" role="group">
                                                            <a data-toggle="tooltip" data-container="body" class="btn btn-default t3js-modal-trigger" href="{moduleUri}&CMD=stop&tx_scheduler[uid]={taskRecord.uid}" data-severity="warning" data-title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:stop')}" data-button-close-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}" data-content="{f:translate(key:'msg.stop')}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:stop')}">
                                                                <core:icon identifier="actions-close"/>
                                                            </a>
                                                        </div>
                                                    </f:then>
                                                    <f:else>
                                                        <div class="btn-group" role="group">
                                                            <a data-toggle="tooltip" data-container="body" class="btn btn-default" href="{moduleUri}&CMD=edit&tx_scheduler[uid]={taskRecord.uid}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:edit')}">
                                                                <core:icon identifier="actions-open"/>
                                                            </a>
                                                            <a data-toggle="tooltip" data-container="body" class="btn btn-default" href="{moduleUri}&CMD=toggleHidden&tx_scheduler[uid]={taskRecord.uid}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:{taskRecord.translationKey}')}">
                                                                <f:if condition="{taskRecord.translationKey} == 'enable'">
                                                                    <f:then>
                                                                        <core:icon identifier="actions-edit-unhide"/>
                                                                    </f:then>
                                                                    <f:else>
                                                                        <core:icon identifier="actions-edit-hide"/>
                                                                    </f:else>
                                                                </f:if>
                                                            </a>
                                                            <a data-toggle="tooltip" data-container="body" class="btn btn-default t3js-modal-trigger" href="{moduleUri}&CMD=delete&tx_scheduler[uid]={taskRecord.uid}" data-severity="warning" data-title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}" data-button-close-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}" data-content="{f:translate(key:'msg.delete')}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}">
                                                                <core:icon identifier="actions-edit-delete"/>
                                                            </a>
                                                        </div>
                                                        <div class="btn-group" role="group">
                                                            <a class="btn btn-default" data-toggle="tooltip" data-container="body" href="{moduleUri}&CMD=setNextExecutionTime&tx_scheduler[uid]={taskRecord.uid}" title="{f:translate(key:'action.run_task_cron')}">
                                                                <core:icon identifier="actions-clock"/>
                                                            </a>
                                                            <a class="btn btn-default" data-toggle="tooltip" data-container="body" href="{moduleUri}&tx_scheduler[execute][]={taskRecord.uid}" title="{f:translate(key:'action.run_task')}">
                                                                <core:icon identifier="actions-play"/>
                                                            </a>
                                                        </div>
                                                    </f:else>
                                                </f:if>
                                            </span>
                                        </td>
                                    </tr>
                                </f:if>
                            </f:for>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </f:if>
</f:for>

<f:if condition="{missingClasses}">
    <div class="tx_scheduler_mod1_table">
        <div class="panel panel-space panel-default recordlist">
            <div class="panel-heading taskGroup" data-task-group-id="missing">
                <f:translate key="label.noClass"/>
                (<span class="t3js-table-total-items" title="{f:translate(key: 'label.noClass.taskCount')}">{missingClasses -> f:count()}</span>)
                <a href="#" class="pull-right t3js-toggle-recordlist"
                    data-table="task-group-missing" data-toggle="collapse" data-target="#recordlist-task-group-missing">
                    <span class="caret"></span>
                </a>
            </div>
            <div class="collapse in" data-state="expanded" id="recordlist-task-group-missing">
                <div class="table-fit">
                    <table class="table table-striped table-hover">
                        <tr class="taskGroup" data-task-group-id="0">
                            <td class="nowrap-disabled"><span>{f:translate(key:'msg.invalidTaskClass') -> f:format.raw()}</span></td>
                        </tr>
                    </table>
                    <table class="table table-striped table-hover taskGroup-table">
                        <thead>
                        <tr>
                            <th><span class="t-span"><f:translate key="label.id"/></span></th>
                            <th><span class="t-span"><f:translate key="task"/></span></th>
                            <th><span class="t-span"></span></th>
                        </tr>
                        </thead>
                        <f:for each="{missingClasses}" as="missingClass">
                            <tr>
                                <td class="right">{missingClass.uid}</td>
                                <td><span class="label label-danger">{missingClass.class}</span></td>
                                <td class="nowrap">
                                    <div class="btn-group" role="group">
                                        <a data-toggle="tooltip" data-container="body" class="btn btn-default t3js-modal-trigger" href="{moduleUri}&CMD=delete&tx_scheduler[uid]={missingClass.uid}" data-severity="warning" data-title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}" data-button-close-text="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:cancel')}" data-content="{f:translate(key:'msg.delete')}" title="{f:translate(key:'LLL:EXT:core/Resources/Private/Language/locallang_common.xlf:delete')}">
                                            <core:icon identifier="actions-edit-delete"/>
                                        </a>
                                    </div>
                                </td>
                            </tr>
                        </f:for>
                    </table>
                </div>
            </div>
        </div>
    </div>
</f:if>
</html>
